home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / Digsby build 37 / digsby_setup.exe / lib / M2Crypto / SSL / Cipher.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2008-10-13  |  2KB  |  59 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. from M2Crypto import m2
  5.  
  6. class Cipher:
  7.     
  8.     def __init__(self, cipher):
  9.         self.cipher = cipher
  10.  
  11.     
  12.     def __len__(self):
  13.         return m2.ssl_cipher_get_bits(self.cipher)
  14.  
  15.     
  16.     def __repr__(self):
  17.         return '%s-%s' % (self.name(), len(self))
  18.  
  19.     
  20.     def __str__(self):
  21.         return '%s-%s' % (self.name(), len(self))
  22.  
  23.     
  24.     def version(self):
  25.         return m2.ssl_cipher_get_version(self.cipher)
  26.  
  27.     
  28.     def name(self):
  29.         return m2.ssl_cipher_get_name(self.cipher)
  30.  
  31.  
  32.  
  33. class Cipher_Stack:
  34.     
  35.     def __init__(self, stack):
  36.         self.stack = stack
  37.  
  38.     
  39.     def __len__(self):
  40.         return m2.sk_ssl_cipher_num(self.stack)
  41.  
  42.     
  43.     def __getitem__(self, idx):
  44.         if idx <= idx:
  45.             pass
  46.         elif not idx < m2.sk_ssl_cipher_num(self.stack):
  47.             raise IndexError('index out of range')
  48.         
  49.         v = m2.sk_ssl_cipher_value(self.stack, idx)
  50.         return Cipher(v)
  51.  
  52.     
  53.     def __iter__(self):
  54.         for i in xrange(m2.sk_ssl_cipher_num(self.stack)):
  55.             yield self[i]
  56.         
  57.  
  58.  
  59.